﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace testTennis
{

    [TestClass]
    public class TestSet
    {
        Set set;

        public TestSet()
        {
            set=new Set();
        }

        [TestMethod]
        public void tao_Set()
        {
            Assert.AreEqual(set.ScoregameP1, 0);
            Assert.AreEqual(set.ScoregameP2, 0);
        }

        [TestMethod]
        public void p1point_true()
        {
            set.ScoregameP1 = 3;
            set.game.scoreP1 = Game.Point.gamepoint;
            set.increasegame();
            Assert.AreEqual(set.ScoregameP1, 4);
        }

        [TestMethod]
        public void p1point_false()
        {
            set.ScoregameP1 = 3;
            set.game.P1.setCurrentPoint("30");
            set.increasegame();
            Assert.AreEqual(set.ScoregameP1, 3);
        }

        public void p2point()
        {
            set.ScoregameP2 = 7;
            set.increasegame();
            Assert.AreEqual(set.ScoregameP2, 8);
        }

        [TestMethod]
        public void p1win_74()
        {
            set.ScoregameP1 = 7;
            set.ScoregameP2 = 4;
            set.game.scoreP1 = Game.Point.gamepoint;
            set.game.winner();
            set.winset();
            Assert.AreEqual(set.result, set.game.P1.getPlayerName());
        }

        [TestMethod]
        public void p2win_57()
        {
            set.ScoregameP1 = 5;
            set.ScoregameP2 = 7;
            set.winset();
            Assert.AreEqual(set.result, set.game.P2.getPlayerName());
        }

        [TestMethod]
        public void p1win_52()
        {
            set.ScoregameP1 = 5;
            set.ScoregameP2 = 2;
            set.game.scoreP1 = Game.Point.gamepoint;
            set.game.winner();
            set.increasegame();
            Assert.AreEqual(set.result, set.game.P1.getPlayerName());

        }

        [TestMethod]
        public void p2win_78()
        {
            set.ScoregameP1 = 7;
            set.ScoregameP2 = 8;
            set.winset();
            Assert.AreEqual(set.result, set.game.P2.getPlayerName());
        }
    }
}
